﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Agility.LoginUI;
using System.Reflection;

namespace Agility.Testing.Silverlight.Accessors
{
    public class LoginRegistrationWindowPrivateAccessor
    {
        LoginRegistrationWindow loginRegistrationWindow;

        public LoginRegistrationWindowPrivateAccessor()
        {
            this.loginRegistrationWindow = new LoginRegistrationWindow();
        }

        public LoginRegistrationWindowPrivateAccessor(LoginRegistrationWindow loginRegistrationWindow)
        {
            this.loginRegistrationWindow = loginRegistrationWindow;
        }

        public RegistrationForm RegistrationForm 
        {
            get { return (RegistrationForm)GetField("registrationForm"); }
        }

        public LoginForm LoginForm 
        {
            get { return (LoginForm)GetField("loginForm");}
        }

        private object GetField(string fieldName)
        {
            Type type = typeof(LoginRegistrationWindow);
            FieldInfo fieldInfo = type.GetField(fieldName);
            return fieldInfo.GetValue(loginRegistrationWindow);
        }
    }
}
